<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('工人投诉具体情况列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>投诉时间：</label>
                            <input type="hidden" id="projectId" name="projectId"/>
                            <input type="text" class="time-input" placeholder="请选择投诉时间" name="complainTime"/>
                        </li>
                        <li>
                            <label>投诉人：</label>
                            <input type="text" name="complainLeader"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "architecture/complain";
    var projects = [[${projects}]];
    var labourSubs = [[${labourSubs}]];

    $(function () {
        let pid = getUrlParam("projectId");
        $("#projectId").val(pid);
        var options = {
            url: '/architecture/home/queryComplain',
            modalName: "工人投诉具体情况",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '记录id',
                    visible: false
                },

                {
                    field: 'projectId',
                    title: '工地',
                    formatter: function (value, row, index) {
                        let msg = value;
                        let bs = projects.filter(x => x.id == value);
                        if (!!bs && bs.length > 0) {
                            msg = bs[0].projectName;
                        }
                        return $.table.tooltip(msg);
                    }
                },
                {
                    field: 'subLabourId',
                    title: '劳务分包单位',
                    formatter: function (value, row, index) {
                        let msg = value;
                        let bs = labourSubs.filter(x => x.id == value);
                        if (!!bs && bs.length > 0) {
                            msg = bs[0].companyName;
                        }
                        return $.table.tooltip(msg);
                    }
                },
                {
                    field: 'complainTime',
                    title: '投诉时间'
                },
                {
                    field: 'complainPlace',
                    title: '投诉地点',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value);
                    }
                },
                {
                    field: 'complainDepartment',
                    title: '投诉部门',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value);
                    }
                },
                {
                    field: 'complainType',
                    title: '投诉类型'
                },
                {
                    field: 'complainLeader',
                    title: '负责人',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value);
                    }
                },
                {
                    field: 'complainMember',
                    title: '成员列表',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value);
                    }
                },
                {
                    field: 'complainContent',
                    title: '投诉内容',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value);
                    }
                },
                {
                    field: 'amountInvolved',
                    title: '涉案金额'
                },
                {
                    field: 'complainNumber',
                    title: '投诉人数'
                }
            ]
        };
        $.table.init(options);
    });

    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg); //匹配目标参数
        if (r != null) return unescape(r[2]);
        return null; //返回参数值
    }


</script>
</body>
</html>